/*
 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package java.util;

/**
 * <p>Marker interface used by {@code List} implementations to indicate that
 * they support fast (generally constant time) random access.  The primary
 * purpose of this interface is to allow generic algorithms to alter their
 * behavior to provide good performance when applied to either random or
 * sequential access lists.
 *
 * <p>The best algorithms for manipulating random access lists (such as
 * {@code ArrayList}) can produce quadratic behavior when applied to
 * sequential access lists (such as {@code LinkedList}).  Generic list
 * algorithms are encouraged to check whether the given list is an
 * {@code instanceof} this interface before applying an algorithm that would
 * provide poor performance if it were applied to a sequential access list,
 * and to alter their behavior if necessary to guarantee acceptable
 * performance.
 *
 * <p>这是一个标记接口（marker interface），由 List 的实现类使用，用于表明它们支持快速（通常是常数时间）随机访问。
 * 该接口的主要目的是让通用算法能够根据所操作的列表类型调整其行为，从而在面对随机访问列表或顺序访问列表时都能提供良好的性能。
 * 对于支持随机访问的列表（如 ArrayList），最适合的算法在应用于顺序访问列表（如 LinkedList）时，可能会产生平方级（quadratic）的时间复杂度。
 * 因此，通用的列表算法应鼓励在执行前检查给定的列表是否是该接口的实例。如果是，并且该算法在顺序访问列表上性能较差，则应调整其行为以保证可接受的性能表现。
 *
 * <p>It is recognized that the distinction between random and sequential
 * access is often fuzzy.  For example, some {@code List} implementations
 * provide asymptotically linear access times if they get huge, but constant
 * access times in practice.  Such a {@code List} implementation
 * should generally implement this interface.  As a rule of thumb, a
 * {@code List} implementation should implement this interface if,
 * for typical instances of the class, this loop:
 *
 * <p>人们认识到，随机访问和顺序访问之间的区别通常是模糊的。
 * 例如，某些 List 实现当数据量巨大时可能提供线性渐近访问时间，但在实际使用中仍表现为常数时间访问。
 * 这种情况下，该 List 实现通常应实现此接口。
 * 作为一个经验法则，如果某个 List 实现的典型实例在实践中表现出较好的随机访问性能，则应当实现此接口。
 *
 * <pre>
 *     for (int i=0, n=list.size(); i &lt; n; i++)
 *         list.get(i);
 * </pre>
 * runs faster than this loop:
 * <pre>
 *     for (Iterator i=list.iterator(); i.hasNext(); )
 *         i.next();
 * </pre>
 *
 * <p>This interface is a member of the
 * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
 * Java Collections Framework</a>.
 *
 * @since 1.4
 */
public interface RandomAccess {
}
